.TH CUECAT 1
.SH NAME
.B cuecat
\- decode :Cue:Cat\*(Tm scan codes and feed them to a shell command
.SH SYNOPSIS
.B cuecat
[
.BI + type
.I ...
] [
.I command ...
]
.SH DESCRIPTION
The 
.B cuecat
script repeatedly reads scan codes from a
:Cue:Cat\*(Tm scanner via standard input, decodes and processes the
scanned value, then prompts with
.B Scan!
for another scan code.
It exits when it reads an EOF on standard input.
.P
The processing starts by filtering the codes by
.IR type ,
then formatting them into a
.IR command
if is is provided, then executing the resulting command.
If no command is provided, the scan code information is printed on
standard output.
.P
If there are no
.I type
filters as well as no command, then the raw information from the scanner
is printed. If either a
.I type
or a
.I command
argument is provided, the scan arguments are converted to EAN13
form. If the conversion fails - because of a bad scan, for instance -
an error is reported.
.P
Filters - of the form
.BI + type
- cause any scan codes not of the indicated 
.I type
(or
.IR types ,
if there more than one is provided)
to be ignored.
.I Types
that start with
.RB \*(lq UP \*(rq
are converted to a UPC code instead of an EAN13 code in this case.
Similarly, type that start with
.RB \*(lq IB \*(rq
is converted to an ISBN (including providing the correct check digit
for the ISBN).
.P
If a
.B command
is provided, it should include a single
.RB \*(lq %s \*(rq
which will be replaced by the code (scan, EAN13, ISBN, or UPC)
resulting from the scan, and then passed to a shell. To get a single
.RB \*(lq % \*(rq
in the command, use
.RB \*(lq %% \*(rq "" .
.P
.SH USAGE
The following command will create a log of all UPA and UPE codes scanned
in the file
.I /tmp/upc-codes :
.IP
.SM cuecat +UPA +UPE 'echo %s >> /tmp/upc-codes'
.P
For books, you can launch the
.B w3m
browser on the amazon.com page for a book with amazon.com's ISBN lookup
facility like so:
.IP
.SM cuecat +IB5 w3m http://www.amazon.com/exec/obidos/ASIN/%s
.P
You can probably substitute your favorite browser, but the command
line syntax may need to change. Likewise, the quoting will depend on
the shell being used.
.P
More complex is using the addall price comparison engine to check a
number of online book stores. That can be done with:
.IP
.SM cuecat +IB5 w3m 'http://www.addall.com/New/submitNew.cgi?location=10000&state=OK&dispCurr=USD&type=ISBN&query=%s'
.P
